'use strict';
const db = uniCloud.database()
exports.main = async (event, context) => {
	const collection = db.collection('project')
	let res = null
	if(event.action=="add"){
		res=await collection.add(event.data)
	}else if(event.action=="upd"){
		res=await collection.doc(event.data.id).update(event.data);
	}else if(event.action=="get"){
		res=await collection.where(event.data||{}).get()
	}
	return res
};